using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using NUnit.Framework;
using System.Collections.Specialized;

namespace CustomCMS.QA
{
	[TestFixture]
	public class Templates
	{
		[Test]
		public void SetTemplate()
		{
			NameValueCollection vals = new NameValueCollection();

			vals["action"] = "set_template";
			vals["path"] = "*";
			vals["templateId"] = "index.tmpl";
			vals["userId"] = "nimrod";
			vals["title"] = "casino.com+cms+rules";
			vals["content"] = "<html><cms:include path=\"*head.tmpl\"/><body><cms:content name=\"header\"/><cms:content name=\"footer\"/></body></html>";
			vals["comment"] = "first+revision";

			XmlDocument doc = Util.ExecuteWebRequest(vals);

			Util.VerifyResult(doc, "Success");

			vals = new NameValueCollection();

			vals["action"] = "set_template";
			vals["path"] = "*";
			vals["templateId"] = "head.tmpl";
			vals["userId"] = "nimrod";
			vals["title"] = "";
			vals["content"] =	"	<head> \n" +
								"		<cms:comment>this will not be populated to the resultant html</cms:comment>\n" +
								"		<meta key=\"<cms:content name=\"meta\"/>\" />\n" +
								"		<link type=\"text/css\" src=\"style/asda.css\"></link>\n" +
								"	</head>";
			vals["comment"] = "first+revision";

			doc = Util.ExecuteWebRequest(vals);

			Util.VerifyResult(doc, "Success");
		}

		[Test]
		public void CreateDirectory()
		{
			NameValueCollection vals = new NameValueCollection();

			vals["action"] = "create_directory";
			vals["path"] = "*promos";
			vals["type"] = "template";

			XmlDocument doc = Util.ExecuteWebRequest(vals);

			Util.VerifyResult(doc, "Success");
		}
	}
}
